{extend name="public/base" /}

{block name="title"}上传文件插件{/block}

{block name="main"}
    
    
    
    <div class="layui-input-block">
        <input type="txt" name="pic" value="" id="JS_upImg_input" />
        <div class="e-upload-img" id="JS_upload_img" style="display: none;"><img src="" /></div>                    
        <button type="button" class="layui-btn" id="JS_upload_btn">
            <i class="layui-icon">&#xe67c;</i>上传图片</button>
	</div>
    
<div class="layui-form layui-form-pane" >
    <div class="layui-input-block">
      <select name="city" >
        <option value=""></option>
        <option value="0">北京</option>
        <option value="1">上海</option>
        <option value="2">广州</option>
        <option value="3">深圳</option>
        <option value="4">杭州</option>
      </select>
    </div>
</div>
 <div style="display: none;">
 
 .ef-images,.ef-images-box{
    display: inline-block;
    width: 134px;
    height: 134px;
 }
 .ef-images{
    float: left;
    margin: 0px 10px 10px 0px;
 }
 
.ef-images:hover{
  transform: scale(1.02);
}
.ef-images-box{    
    line-height: 134px;
    text-align: center;
    border: double;
    border-width: 1px;
    border-color: #eee;
    padding-bottom: 1px;
}

 .ef-images-box:hover{
    border-color: #ff5722;/*#FFEB3B;*/
 }
 .ef-images-box img{
    vertical-align: middle;
    max-width: 100%;
    max-height: 100%;
 } 
 
 .ef-images-preshow{
    width: 50px;
    height: 50px;
    line-height:50px;
    margin: 0px 0px 4px 4px;
}
 
 .ef-images-check{
    position: relative;
    z-index: 99;
    bottom: 130px;
    color: #009688;
    font-weight: 900;
    font-size: 40px;
    cursor: pointer;
 }
.ef-images-preshow .ef-images-check{
    bottom: 40px;
    font-size: xx-large;
    float: right;
}
.ef-images-btn{
    position: relative;
    bottom: 135px;
    left: 1px;
    text-align: right;
    background-color: #b14f4f;
    background-color: rgba(0,0,0,0.3);
    /*display: none;
    filter:alpha(Opacity=30);-moz-opacity:0.3;opacity: 0.3; */
 }
 .ef-images-txt{
    position: relative;
    bottom: 135px;
    left: 1px;
    height: 90px;
    background-color: #b14f4f;
    background-color: rgba(0,0,0,0.4);
    color: #fff;
    padding: 4px;
    /*display: none;*/
 }
 </div>
 
 <style>
 
 .ef-images,.ef-images-box{
    display: inline-block;
    width: 134px;
    height: 134px;
 }
 .ef-images{
    position: relative;
    float: left;
    margin: 0px 10px 10px 0px;
 }
 
.ef-images:hover{
  transform: scale(1.02);
}
.ef-images-box{    
    line-height: 134px;
    text-align: center;
    border: double;
    border-width: 1px;
    border-color: #eee;
    padding-bottom: 1px;
}

 .ef-images-box:hover{
    border-color: #009688;
 }
 .ef-images-box img{
    vertical-align: middle;
    max-width: 100%;
    max-height: 100%;
 } 
 
 .ef-images-preshow{
    position: relative;
    width: 50px;
    height: 50px;
    line-height:50px;
    margin: 0px 0px 4px 4px;
}
 
 .ef-images-check{
    position: absolute;
    z-index: 99;
    right: -10px;
    bottom: 50px;
    color: #009688;
    font-weight: 900;
    font-size: 40px;
    cursor: pointer;
    /*display: none; */
 }
.ef-images-preshow .ef-images-check{
    right: 0px;
    bottom: 0px;
}
 .ef-images-txt{
    position: relative;
    bottom: 135px;
    left: 1px;
    height: 134px;
    background-color: #b14f4f;
    background-color: rgba(0,0,0,0.4);
    color: #fff;
    display: none;
 }
 
 .ef-images-btn{
    display: block;
    position: absolute;
    width: 100%;
    text-align: right;
    bottom: 0px;
 }
 .ef-images-select-top{
    display: block;
    height: 40px;
    line-height: 40px;
    margin-bottom: 18px;
 }
 .ef-images-more{
    margin: 20px 0px;
    float: left;
    width: 100%;
    text-align: center;
 }
 
 </style>
 
 
 
{/block}

{block name="script"}

<script>

layui.use(['images','common'],function(){
    // 图片上传图片
    layui.images.render({
        saveH : 1,
        saveW : 1,
        elem : '#JS_upload_btn',
      //  num : 3,
        //url  : JS_config.url_upload, //上传接口
        type : 'cases',
        done : function(ret){
            console.log( ret );
            if( ret.code == 1 ){
                $('#JS_upload_img').show();
                $('#JS_upload_img img').attr('src',ret.data[0]);
                $('#JS_upImg_input').val(ret.data[0]);
            }else{
                layui.common.error(ret.msg);
            }
        }
    }); 
});
</script>
{/block}